<template>
  <div class="hot">
    <div class="hot-title">
      <div class="hot-title-content hot-title-left">
        <img src="http://img1.qunarzz.com/piao/fusion/1711/16/bfbb9874e8f11402.png" /> 本周热门榜单
      </div>
      <div class="hot-title-content hot-title-right">
        全部榜单<span class="iconfont iconyoujiantou"></span>
      </div>
    </div>
    <ul class="hot-list">
      <li @click="toDetails(item)" class="hot-item" v-for="item of hotList" :key="item.id">
        <img :src="item.imgUrl" :alt="item.title">
        <p class="hot-item-title">{{ item.title }}</p>
        <p class="price"><span>￥{{ item.price }}</span>起</p>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    hotList: {
      required: true,
      type: Array,
      defaultValue: []
    }
  },
  methods: {
    toDetails (data) {
      // console.log(data)
      this.$router.push({
        path: '/details',
        query: {data}
      })
    }
  }
}
</script>

<style scoped lang="stylus">
  @import "~@/assets/css/common.styl"
  .hot {
    margin-top: .2rem;
    background-color: #fff;
    font-size: .32rem;
    padding: 0 7px;
  }
  .hot-title{
    display: flex;
    padding: 12px 0;
  }
  .hot-title img {
    width: .3rem;
    height: .3rem;
  }
  .hot-title-content {
    flex: 1;
  }
  .hot-title-right {
    font-size: .24rem;
    position: relative;
    left: 2.3rem;
  }
  .hot-title-right span {
    font-size: .2rem;
  }
  .hot-list {
    width: 100%;
    font-size: .24rem;
    overflow-x: scroll;
    overflow-y: hidden;
    white-space: nowrap;
    padding-top:3px;
  }
  .hot-item {
    width: 2rem;
    text-align: center;
    display: inline-block;
    margin-right: .1rem;
    position: relative;
  }
  .hot-item:nth-child(1):before {
    $tag('Top.1',#ff7d32, #ff252d);
  }
  .hot-item:nth-child(2):before {
    $tag('Top.2',#ff7d32, #ff252d);
  }
  .hot-item:nth-child(3):before {
    $tag('Top.3',#ffc21e, #ff991e);
  }
  .hot-item img {
    width: 100%;
    height: 2rem;
  }
  .hot-item-title {
    margin-top: .12rem;
    $txtOverflow();
  }
  .price {
    padding: .06rem 0 .2rem;
  }
  .price span {
    color: #ff8300;
    font-size: .28rem;
    font-weight: 500;
  }
</style>
